<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>时间选择器</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0-beta/css/bootstrap.min.css">
    <link href="css/datetimepicker.min.css" rel="stylesheet">
</head>

<body>
    <section class="container">
        <h3>
            时间选择器
        </h3>
        <p>
            便于用户选取时间日期。"时间"和"日期"以外不被火狐兼容
        </p>
        <!-- item -->
        <div class="card my-4">
            <div class="card-header">
                <h5 class="text-primary">默认</h5>
            </div>
            <div class="card-body">
                <form>
                    <div class="form-group">
                        <label for="usr">日期时间:</label>
                        <input type="datetime-local" class="form-control" id="usr">
                    </div>
                    <div class="form-group">
                        <label for="pwd">日期:</label>
                        <input type="date" class="form-control" id="pwd">
                    </div>
                    <div class="form-group">
                        <label for="pwd">时间:</label>
                        <input type="time" class="form-control" id="pwd">
                    </div>
                    <div class="form-group">
                        <label for="pwd">周:</label>
                        <input type="week" class="form-control" id="pwd">
                    </div>
                    <div class="form-group">
                        <label for="pwd">月份:</label>
                        <input type="month" class="form-control" id="pwd">
                    </div>
                </form>
            </div>
        </div>
        </div>
        <!-- item end-->
        <!-- item -->
        <div class="card my-4">
            <div class="card-header">
                <h5 class="text-primary">时间日期插件</h5>
                <p>依赖
                    <a href="http://www.bootcss.com/p/bootstrap-datetimepicker/">bootstrap-datetimepicker</a>
                </p>
            </div>
            <div class="card-body">
                <div class="form-group">
                    <label for="pwd">日期时间:</label>
                    <!-- input -->
                    <input rel='date' type="text" class="form-control">
                </div>
                <div class="form-group">
                    <label for="pwd">月份:</label>
                    <!-- input -->
                    <input rel='date-mouth' type="text" class="form-control">
                </div>
                <div class="form-group">
                    <label for="pwd">日:</label>
                    <!-- input -->
                    <input rel='date-day' type="text" class="form-control">
                </div>
                <div class="form-group">
                    <label for="pwd">时间:</label>
                    <!-- input -->
                    <input rel='date-time' type="search" class="form-control">
                </div>
                <div class="form-group">
                    <label for="pwd">时间:</label>
                    <!-- input -->
                    <input rel='date-time' type="search" class="form-control">
                </div>

            </div>

        </div>
        <!-- item end -->
    </section>
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="../../js/page.js"></script>
    <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"></script>
    <script src="js/datetimepicker.min.js"></script>
    <script>
        $(function () {
            $("[rel='date']").datetimepicker({
                weekStart: 1,//一周的开始时间
                todayBtn: 1,//当前按钮
                autoclose: 1,//自动关闭
                todayHighlight: 1,//今天高亮
                startView: 2,//视图 月
                forceParse: 0,//读取输入框时间
                showMeridian: 1,//此选项将启用日间和小时视图的子午线视图。
                format: "yyyy-mm-dd hh:ii"
            });

            $("[rel='date-mouth']").datetimepicker({
                autoclose: 1,
                startView: 3,//视图 年
                minView: 3,//最小显示的视图
                maxView: 3,//最大显示的视图
                forceParse: 0,
                format: "yyyy-mm"
            });

            $("[rel='date-day']").datetimepicker({
                autoclose: 1,
                startView: 2,//视图 月
                minView: 2,
                maxView: 2,
                forceParse: 0,
                format: "yyyy-mm-dd"
            });
            $("[rel='date-time']").datetimepicker({
                autoclose: 1,
                startView: 1,//视图 日
                minView: 0,
                maxView: 1,
                showMeridian: true,//此选项将启用日间和小时视图的子午线视图。
                forceParse: 0,
                format: "P hh:ii"
            });
        })
    </script>
</body>

</html>